<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>员工信息显示</title>

    <link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/dashboard/">

    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->


</head>
<body>
<!-- 因为图片大小不一致，有点太小了，特别是宽度，可能导致显示效果不好 -->
<!-- 导航 -->
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Brand</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">Link</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">[[${session.login}]] <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a th:href="@{/loginOut}">[[#{login.out}]]</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<!--员工数据表格显示-->
<div class="container table-responsive" style="margin-top: 50px">
    <table class="table table-bordered">
        <caption class="caption"><a th:href="@{/showemp}">显示员工信息</a> | <a th:href="@{/add}">添加</a></caption>
        <thead>
            <tr>
                <th>序号</th>
                <th>ID</th>
                <th>Name</th>
                <th>Password</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="book,statu:${page?.records}">
                <th>[[${statu.count}]]</th>
                <td th:text="${book.id}"></td>
                <td>[[${book.name}]]</td>
                <td>[[${book.password}]]</td>
                <td>
                    <a th:href="@{/delete/{id}(id=${book.id},pn=${page?.current})}" type="button" class="btn btn-danger btn-sm">删除</a>
                    <a th:href="@{/update/{id}(id=${book.id},pn=${page?.current})}" type="button" class="btn btn-info btn-sm">更改</a>
                </td>
            </tr>
        </tbody>
    </table>
    <div class="row-fluid">
        <div class="span6">
            <div>当前第 [[${page?.current}]] 页 总计 [[${page?.pages}]] 页 共 [[${page?.total}]] 条记录</div>
        </div>
        <div class="span6">
            <nav  aria-label="Page navigation">
                <ul class="pagination">
                    <!--The operator 'SUBTRACT' is not supported between objects of type 'null' and 'java.lang.Integer'-->
                    <li th:class="${page?.current==1?'disable':''}" class="prev"><a aria-label="Previous" th:href="@{/showemp(pn=${((page?.current)==null?0:page.current)-1})}"><span aria-hidden="true">&laquo;</span></a></li>
                    <li th:class="${num==page?.current?'active':''}" th:each="num:${#numbers.sequence(1,((page?.current)==null?1:page.pages))}"><a th:href="@{/showemp(pn=${num})}">[[${num}]]</a></li>
                    <!--SpelEvaluationException: EL1030E: The operator 'ADD' is not supported between objects of type 'null' and 'java.lang.Integer'-->
                    <li th:class="${page?.current==page?.pages?'disable':''}" class="next"><a aria-label="Next" th:href="@{/showemp(pn=${((page?.current)==null?0:page.current)+1})}"><span aria-hidden="true">&raquo;</span></a></li>
                </ul>
            </nav>
        </div>
    </div>
</div>

<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<!-- <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script> -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</body>
</html>
